<%include file="header.html"%>
<%include file="top.html"%>
<%include file="left.html"%>

<style>
.table {
    margin-bottom: 5px;
}

.alert {
    margin-bottom: 10px;
}
body,h1,p,blockquote,dl,dt,dd,ul,ol,li,input{margin:0;padding:0;}
.autoDis{border:1px solid #999;position:absolute;overflow:hidden;}
.autoDis p{line-height:25px;cursor:default;padding:0 5px;}
.autoDis li{line-height:25px;cursor:default;padding:0 5px;background-color:#fff;}
.autoDis .cur{background:#ccc;}

input[type=checkbox].ace, input[type=radio].ace {
opacity: 0;
position: absolute;
z-index: 12;
width: 18px;
height: 20px;
cursor: pointer;
}

.table-header {
background-color: #307ecc;
color: #FFF;
font-size: 14px;
line-height: 35px;
padding-left: 12px;
margin-bottom: 1px;
padding-bottom:2px;
}

.comments {
 width:100%;/*自动适应父布局宽度*/
 overflow:auto;
 word-break:break-all;
 border-color:#307ecc;
 float:left;
 }

.table th, .table td {
	text-align: center;
}
</style>
<div class="main-content">
<div class="breadcrumbs" id="breadcrumbs"><script
	type="text/javascript">
	try {
		ace.settings.check('breadcrumbs', 'fixed')
	} catch (e) {
	}
</script>

<ul class="breadcrumb">
	<li><i class="icon-home home-icon"></i> <a
		href="index.php">首页</a></li>
</ul>
<!-- .breadcrumb --></div>
<div class ="col-lg-2" >
</div>
<div class="page-content col-lg-8 col-md-12 col-sm-12 col-xs-12">
<div class="col-xs-12">

<div  class="alert alert-info col-lg-12 col-md-12 col-sm-12 col-xs-12">
<form class="form-horizontal" role="form">
<div class="row">
<div class="col-sm-6">
<div class="row">
<label class="col-sm-6 control-label no-padding-right" for="form-field-5">游戏</label>
<div class="col-sm-3"><select id="selectGame">
	<option value="" >游戏</option>
	<%if $selectGames%> <%foreach from = $selectGames key = key item = value%>
	<%if $nowGame == $value %>
	<option value="<%$value%>" selected><%$value%></option>
	<%else%>
	<option value="<%$value%>"><%$value%></option>
	<%/if%> <%/foreach%> <%/if%>
</select>
</div>
</div>
</div>

<div class="col-sm-6">
<div class="row">
<label class="col-sm-3 control-label no-padding-right" for="form-field-5">区服</label>
<div class="col-sm-3">
<select style="width:120px;" id="selectServer">
	<option value="" id="server">区服</option>

	<%if $serverLists%> <%foreach from = $serverLists key = key item = serverList%>
	<%if $nowServer == $serverList.server %>
	<option value="<%$serverList.server%>" selected><%$serverList.server%></option>
	<%else%>
	<option value="<%$serverList.server%>"><%$serverList.server%></option>
	<%/if%> <%/foreach%> <%/if%>

</select>
</div>
</div>
</div>
</div>
</form>
</div>

</div>

<div  class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div align="left" style="width:100%" id ="servers2" class="table-header">
<button id="view_1" type="button" onClick="view1();"
	class="width-10 btn btn-sm btn-primary">信息修改
</button>

<%if $userNode_10005 && $userNode_10005 == 10005%>

<button id="view_2" type="button" onClick="view2();"
	class="width-10 btn btn-sm btn-primary">用户操作
</button>

<button id="view_3" type="button" onClick="view3();"
	class="width-10 btn btn-sm btn-primary">服务器操作
</button>
<button id="view_7" type="button" onClick="view7();"
		class="width-10 btn btn-sm btn-primary">邮件记录
</button>
<button id="view_4" type="button" onClick="view4();"
	class="width-10 btn btn-sm btn-primary">批量补偿
</button>

<button id="view_5" type="button" onClick="view5();"
		class="width-10 btn btn-sm btn-primary">公告相关
</button>
<button id="view_6" type="button" onClick="view6();"
		class="width-10 btn btn-sm btn-primary">区服状态
</button>


<%/if%>

</div>
</div>


<div id="view4" style="display:none" class="col-xs-12">
<center>
<table style="width:100%;" id="sample-table-1" class="table table-striped table-bordered table-hover">

<%if $channel_0%>
<tr>
<td>
<form>
<div align="left" class="form-group list-inline">
     <label class="col-sm-2 control-label no-padding-right" for="form-field-2">平台：<%$channel_0%></label>
    <input  name="checkboxs_all" type="checkbox" class="ace ace-checkbox-2 " id="<%$channel_0%>_selectAll" value="全选/反选">
    <label  class="lbl " for="ace-settings-navbar">&nbsp;全选/反选</label>

    <!--
    <input name="checkboxs_all" type="checkbox" class="ace ace-checkbox-2" id="<%$channel_0%>_selectAll" value="全选/反选">
    <label style="width:100px;" class="lbl col-sm-2" for="ace-settings-navbar">全选/反选</label>
     -->

</div>
</form>
</td>
</tr>
<tr>
<td>
<form>
	<div id="<%$channel_0%>" align="left" class="form-group">
		<%if $serverLists%>
		<%foreach from=$serverLists key=k item = server%>

		 <%if $server.platform == $channel_0 %>
		 <input  name="checkboxs" type="checkbox" class="ace ace-checkbox-2" id="game_<%$server.server%>"   value = "<%$server.server%>" />
		 <label style="width:110px;" class="lbl" for="ace-settings-navbar"><%$server.server%></label>

		 <%if $server.serverId > 0 && $server.serverId%7 == 0%>
		   <br/>
		 <%/if%>

		 <%/if%>

		<%/foreach%>
		<%/if%>
	</div>
</form>
</td>
</tr>
<%/if%>

<%if $channel_1%>
<tr>
<td>
<div align="left" class="form-group">
<label class="col-sm-2 control-label no-padding-right" for="form-field-5">平台：<%$channel_1%></label>
	<input  name="checkboxs_all" type="checkbox" class="ace ace-checkbox-2" id="<%$channel_1%>_selectAll"   value = "全选" />
	<label style="width:100px;" class="lbl" for="ace-settings-navbar">&nbsp;全选/反选</label>
</div>
</td>
</tr>
<tr>
<td>
<form>
	<div id="<%$channel_1%>" align="left" class="form-group">
		<%if $serverLists%>
		<%foreach from=$serverLists key=k item = server%>

		<%if $server.platform == $channel_1 %>
			<input  name="checkboxs" type="checkbox" class="ace ace-checkbox-2" id="game_<%$server.server%>"   value = "<%$server.server%>" />
			<label style="width:110px;" class="lbl" for="ace-settings-navbar"><%$server.server%></label>

			<%if $server.serverId > 0 && $server.serverId%7 == 0%>
		  	   <br/>
			<%/if%>
		<%/if%>

		<%/foreach%>
		<%/if%>
	</div>
</form>
</td>
</tr>
<%/if%>

<%if $channel_2%>
<tr>
<td>
<div  align="left" class="form-group">
<label class="col-sm-1 control-label no-padding-right" for="form-field-5"><%$channel_2%></label>
		<input  name="checkboxs_all" type="checkbox" class="ace ace-checkbox-2" id="<%$channel_2%>_selectAll"   value = "全选" />
	<label style="width:100px;" class="lbl" for="ace-settings-navbar">&nbsp;全选/反选</label>
</div>
</td>
</tr>
<tr>
<td>
<form>
	<div id="<%$channel_2%>" align="left" class="form-group">
		<%if $serverLists%>
		<%foreach from=$serverLists key=k item = server%>

		 <%if $server.platform == $channel_2 %>
		<input  name="checkboxs" type="checkbox" class="ace ace-checkbox-2" id="game_<%$server.server%>"   value = "<%$server.server%>" />
		<label style="width:110px;" class="lbl" for="ace-settings-navbar"><%$server.server%></label>
			<%if $server.serverId > 0 && $server.serverId%7 == 0%>
		      <br/>
		   <%/if%>
		<%/if%>

		<%/foreach%>
		<%/if%>
	</div>
</form>
</td>
</tr>
<%/if%>





<%if $channel_3%>
<tr>
<td>
<div  align="left" class="form-group">
<label class="col-sm-1 control-label no-padding-right" for="form-field-5"><%$channel_3%></label>
		<input  name="checkboxs_all" type="checkbox" class="ace ace-checkbox-2" id="<%$channel_3%>_selectAll"   value = "全选" />
	<label style="width:100px;" class="lbl" for="ace-settings-navbar">&nbsp;全选/反选</label>
</div>
</td>
</tr>
<tr>
<td>
<form>
	<div id="<%$channel_3%>" align="left" class="form-group">
		<%if $serverLists%>
		<%foreach from=$serverLists key=k item = server%>

		 <%if $server.platform == $channel_3 %>
		<input  name="checkboxs" type="checkbox" class="ace ace-checkbox-2" id="game_<%$server.server%>"   value = "<%$server.server%>" />
		<label style="width:110px;" class="lbl" for="ace-settings-navbar"><%$server.server%></label>
			<%if $server.serverId > 0 && $server.serverId%7 == 0%>
		      <br/>
		   <%/if%>
		<%/if%>

		<%/foreach%>
		<%/if%>
	</div>
</form>
</td>
</tr>
<%/if%>


</table>
</center>
</div>

<form id="view5" class="form-horizontal" role="form">


<div  class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<table  id="sample-table-1" class="table table-striped table-bordered table-hover">
	<thead>
		<tr>
			<th>查询条件</th>
			<th>查询信息</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>

		<tr>
			<td>角色名</td>
			<td>
			<div class="col-sm-12">
				<input type="text" id="user_role" placeholder="角色名"  class="col-xs-6 col-sm-9" value="<%$role%>">
			</div>
			</td>
			<td><center>
				<button valign="bottom" type="button" onclick="selectRole('role');" class="btn   btn-primary btn-sm" >
							查询
				</button>
				</center>
			</td>
		</tr>

				<tr>
			<td>Puid</td>
			<td>
			<div class="col-sm-12">
				<input type="text" id="user_puid" placeholder="puid"  class="col-xs-6 col-sm-9" value="<%$puid%>">
			</div>
			</td>
			<td><center>
				<button valign="bottom" type="button" onclick="selectRole('puid');" class="btn   btn-primary btn-sm">
							查询
				</button>
				</center>
			</td>
		</tr>

				<tr>
			<td>用户id</td>
			<td>
			<div class="col-sm-12">
				<input type="text" id="user_id" placeholder="playerId"  class="col-xs-6 col-sm-9" value="<%$playerid%>">
			</div>
			</td>
			<td><center>
				<button valign="bottom" type="button" onclick="selectRole('id');" class="btn   btn-primary btn-sm">
							查询
				</button>
				</center>
			</td>
		</tr>

	</tbody>
</table>
</div>
</form>


<div align="center"  class="col-xs-12">

<!--
<div align="left" style="width:100%" id ="servers2" class="table-header">

<button type="button" onClick="view1();"
	class="width-10 btn btn-sm btn-primary">信息修改
</button>

<button type="button" onClick="view2();"
	class="width-10 btn btn-sm btn-primary">用户操作
</button>

<button type="button" onClick="view3();"
	class="width-10 btn btn-sm btn-primary">服务器操作
</button>

</div>


style="height:650px;overflow-x:auto;overflow-y:auto;"
-->


<div  id="view1"  class="table-responsive">
<center>
<div  style="width:100%;" class="table-header">
用户信息查询
</div>
</center>

<center>
<table style="width:100%"  id="sample-table-1"
	class="table table-striped table-bordered table-hover">
	<thead>
		<tr>
			<th>key</th>
			<th>value</th>
			<th>修改值</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
		<%foreach from=$viewData item=viewData%>
		<tr>
			<td  style="width:30%""><%$viewData.key%></td>
			<td  style="width:30%"><input type="text" id="key_<%$viewData.key%>" value="<%$viewData.value%>" disabled="disabled" class="col-xs-6 col-sm-9"></td>

			<%if $viewData.isChange == 1 && $userNode_10005 == 10005 %>
			<td  style="width:20%"><input type="text" id="value_<%$viewData.key%>"  value="" class="col-xs-6 col-sm-9"></td>
			<td  style="width:20%">
				 <button valign="bottom" type="button" onclick="changeRoleInfo('<%$viewData.key%>','value_<%$viewData.key%>');" class="btn   btn-primary btn-sm">
							修改
				</button>
			</td>
			<%else%>
			<td  style="width:20%">-</td>
			<td  style="width:20%">
							-
			</td>
			<%/if%>
		<%/foreach%>
	</tbody>
</table>
</center>
</div>

<div  id="view2"  style="display:none" class="table-responsive">
<center>
<div  style="width:100%;" class="table-header">
用户操作
</div>
</center>

<center>
<table  style="width:100%;"  id="sample-table-1"
	class="table table-striped table-bordered table-hover">


		<thead>
	<tr>
			<th style="text-align:left" colspan="6">发送奖励</th>
	</tr>
	</thead>
	<tr>

			<style>
		/*		  textarea {
				       outline: thin dotted #F59942;
				   }
		*/
			</style>

			<td colspan="5">
			<!--  	<textarea class="comments" style="border-color:#D5D5D5" placeholder="消息" id="awardMsg"  rows="3" name="s1" cols="40" onpropertychange="this.style.posHeight=this.scrollHeight"></textarea>-->

			  	 <input type="text" id="awardMsg" placeholder="消息" class="col-xs-12 col-sm-12">
			</td>


			<td rowspan="3">
				 <button style="margin-top:45px;" valign="bottom" type="button" onclick="sendAward();" class="btn btn-primary btn-sm">
							发送
				</button>
			</td>
	</tr>


	<tr>

			<style>
		/*		  textarea {
				       outline: thin dotted #F59942;
				   }
		*/
			</style>


			<td colspan="5">
		<!--		<textarea placeholder="奖励内容" style="border-color:#D5D5D5" id="awardInfo" class="comments" rows="3" name="s1" cols="10" onpropertychange="this.style.posHeight=this.scrollHeight"></textarea> -->
		  		 <input type="text" id="awardInfo" placeholder="(奖励内容)可手动输入奖励内容或使用下方菜单添加奖励" class="col-xs-12 col-sm-12">
			</td>


	</tr>

	<tr>
		<td colspan="1">
				<select id="itemType1">
	<option value="">类别</option>
		<%if $gm_awardsinfo%> <%foreach from = $gm_awardsinfo key = key item = data%>
		<%if $nowAttr == $data.id %>
		<option value="<%$data.id%>" selected><%$data.name%></option>
		<%else%>
		<option value="<%$data.id%>"><%$data.name%></option>
		<%/if%> <%/foreach%> <%/if%>
	</select>
		</td>
		<td colspan="1">
    <select style="width:120px;" id="itemTools1">
	<option value="" >物品</option>
	</select>

		</td>
		<td colspan="1">
		 <input type="text" id="itemNum1" placeholder="数量" class="col-xs-6 col-sm-6">
		</td>
		<td colspan="1">
		<button  valign="bottom" type="button" onclick="addItems(1);" class="btn btn-primary btn-sm">
				添加
		</button>
		</td>
		<td colspan="1">
		<button  valign="bottom" type="button" onclick="removeItems(1);" class="btn btn-primary btn-sm">
				重置
		</button>
		</td>
	</tr>




	<thead>
		<tr>
			<th style="text-align:left" colspan="6">用户充值(根据商品id)</th>
		</tr>
	</thead>
	<tbody>
		<tr>

<!--
			<td>
				<select id="selectChannel1">
	<option value="" >渠道</option>
		<%if $channelInfo%> <%foreach from = $channelInfo key = key item = value%>
		<%if $nowChannel == $value %>
		<option value="<%$value%>" selected><%$value%></option>
		<%else%>
		<option value="<%$value%>"><%$value%></option>
		<%/if%> <%/foreach%> <%/if%>
	</select>
			</td>
-->

			<td colspan="5">
				 <input type="text" id="goodsId"  placeholder="goodsId" class="col-xs-6 col-sm-6">
			</td>

			<td>
				 <button valign="bottom" type="button" onclick="recharge('id');" class="btn   btn-primary btn-sm">
							充值
				</button>
			</td>
	</tr>

	<thead>
	<tr>
			<th style="text-align:left" colspan="6">用户充值(任意金额)</th>
	</tr>
	</thead>
	<tr>

<!--
			<td>
				<select id="selectChannel2">
	<option value="" >渠道</option>
		<%if $channelInfo%> <%foreach from = $channelInfo key = key item = value%>
		<%if $nowChannel == $value %>
		<option value="<%$value%>" selected><%$value%></option>
		<%else%>
		<option value="<%$value%>"><%$value%></option>
		<%/if%> <%/foreach%> <%/if%>
	</select>
			</td>
-->


			<td colspan="3">
				 <input type="text" id="orderId" placeholder="订单号" class="col-xs-6 col-sm-9">
			</td>

			<td colspan="2">
				 <input type="text" id="rechargeMoney" placeholder="充值金额" class="col-xs-6 col-sm-9">
			</td>

			<td>
				 <button valign="bottom" type="button" onclick="recharge('order');" class="btn   btn-primary btn-sm">
							充值
				</button>
			</td>
	</tr>






<!--
	<thead>
	<tr>
			<th colspan="6">添加装备</th>
	</tr>
	</thead>
	<tr>

			<td colspan="2">
				 <input type="text" id="equipId" placeholder="装备id" class="col-xs-6 col-sm-9">
			</td>

			<td>
				 <input type="text" id="equipNum" placeholder="装备数量" class="col-xs-6 col-sm-9">
			</td>

			<td>
				 <input type="text" id="starlevel1" placeholder="starlevel1" class="col-xs-6 col-sm-9">
			</td>

			<td>
				 <input type="text" id="starlevel2" placeholder="starlevel2" class="col-xs-6 col-sm-9">
			</td>

			<td>
				 <button valign="bottom" type="button" onclick="addEquip();" class="btn   btn-primary btn-sm">
							添加
				</button>
			</td>
	</tr>
-->

	<thead>
	<tr>
			<th style="text-align:left" colspan="6">公会会长转让</th>
	</tr>
	</thead>
	<tr>
			<!--
			<td colspan="2">
				 <input type="text" id="" placeholder="军团id" disabled="disabled"  class="col-xs-6 col-sm-9">
			</td>
			-->
			<td colspan="3">
				 <input type="text" id="allianceId_1" placeholder="allianceId"  class="col-xs-6 col-sm-9">
			</td>

			<!--
			<td>
				 <input type="text" id="" placeholder="会长id" disabled="disabled"  class="col-xs-6 col-sm-9">
			</td>
			-->
			<td colspan="2">
				 <input type="text" id="leaderId" placeholder="leaderId" class="col-xs-6 col-sm-9">
			</td>

			<td>
				 <button valign="bottom" type="button" onclick="changeLeader();" class="btn   btn-primary btn-sm">
							转让
				</button>
			</td>
	</tr>

	</tbody>
</table>

<table  style="width:100%;"  id="sample-table-1"
	class="table table-striped table-bordered table-hover">
	<thead>
		<tr>
			<th style="text-align:left" colspan="<%$num%>">单个用户操作</th>
		</tr>
	</thead>
	<tbody>
		<tr>

		<%if $userOperation %>
		<%foreach from=$userOperation item=userOperation%>
			<td>
				 <button valign="bottom" type="button" onclick="userOperation(<%$userOperation.id%>);" class="btn   btn-primary btn-sm">
							<%$userOperation.desc%>
				</button>
			</td>
		<%/foreach%>
		<%/if%>
	</tbody>
</table>
</center>
</div>


<div  id="view3"  style="display:none" class="table-responsive">
<center>
<div  style="width:100%;" class="table-header">
服务器操作
</div>
</center>


<center>
<table  style="width:100%;"  id="sample-table-1"
	class="table table-striped table-bordered table-hover">
	<thead>
		<tr>
			<th style="text-align:left" colspan="6">全服邮件</th>
		</tr>
	</thead>

		<tr>
			<td colspan="5" >
		  		 <input type="text" id="test_playerId" placeholder="测试playerIds(多个用,隔开)" value="<%$test_playerId%>" class="col-xs-12 col-sm-12">
			</td>

			<td  rowspan="4">
				 <button style="margin-top:15px;" valign="bottom" type="button" onclick="selectOneUserInfo();" class="btn   btn-primary btn-sm">
							查询用户
				</button>
					<br/>
				 <button style="margin-top:15px;" valign="bottom" type="button" onclick="sendMulUserAwardTest();" class="btn   btn-primary btn-sm">
							发送测试
				</button>
					<br/>
				 <button style="margin-top:15px;margin-left:-5px;" valign="bottom" type="button" onclick="javascript:if(confirm('确认发送全服邮件吗?'))sendServerAward();" class="btn   btn-primary btn-sm">
							发送全服
				</button>
			</td>

		</tr>

		<tr>

			<td colspan="5" >
		  		 <input type="text" id="server_awardMsg" placeholder="消息" class="col-xs-12 col-sm-12">
			</td>

        </tr>


        	<tr>

			<td colspan="5" >
			<!--	 <textarea class="comments" style="border-color:#D5D5D5" placeholder="奖励内容" id="server_awardInfo"  rows="3" name="s1" cols="10" onpropertychange="this.style.posHeight=this.scrollHeight"></textarea> -->
			  	 <input type="text" id="server_awardInfo" placeholder="(奖励内容)可手动输入奖励内容或使用下方菜单添加奖励" class="col-xs-12 col-sm-12">
			</td>


        </tr>

       <tr>
		<td colspan="1">
				<select id="itemType2">
	<option value="">类别</option>
		<%if $gm_awardsinfo%> <%foreach from = $gm_awardsinfo key = key item = data%>
		<%if $nowAttr == $data.id %>
		<option value="<%$data.id%>" selected><%$data.name%></option>
		<%else%>
		<option value="<%$data.id%>"><%$data.name%></option>
		<%/if%> <%/foreach%> <%/if%>
	</select>
		</td>
		<td colspan="1">
    <select style="width:120px;" id="itemTools2">
	<option value="" >物品</option>
	</select>

		</td>
		<td colspan="1">
		 <input type="text" id="itemNum2" placeholder="数量" class="col-xs-6 col-sm-6">
		</td>
		<td colspan="1">
		<button  valign="bottom" type="button" onclick="addItems(2);" class="btn btn-primary btn-sm">
				添加
		</button>
		</td>
		<td colspan="1">
		<button  valign="bottom" type="button" onclick="removeItems(2);" class="btn btn-primary btn-sm">
				重置
		</button>
		</td>
	</tr>

	<thead>
		<tr>
			<th>playerId</th>
			<th>puid</th>
			<th>playerName</th>
			<th>level</th>
			<th>isOnline</th>
			<th>status</th>
		</tr>
	</thead>
	<tbody>
		<%foreach from=$test_playerInfos item=playerInfo%>
		<tr>
			<td  ><%$playerInfo.id%></td>
			<td  ><%$playerInfo.puid%></td>
			<td  ><%$playerInfo.name%></td>
			<td  ><%$playerInfo.level%></td>
			<td  ><%$playerInfo.isOnline%></td>
			<td  ><%$playerInfo.status%></td>
		<tr/>
		<%/foreach%>
	</tbody>


	<thead>
		<tr>
			<th style="text-align:left" colspan="6">全服聊天公告</th>
		</tr>
	</thead>
		<tr>
			<td colspan="5">
				 <input type="text" id="broadcast_chat" placeholder="聊天公告" class="col-xs-6 col-sm-12">
			</td>

			<td>
				 <button valign="bottom" type="button" onclick="broadcast('chat');" class="btn   btn-primary btn-sm">
							发送
				</button>
			</td>

        </tr>

		<thead>
		<tr>
			<th style="text-align:left" colspan="6">全服广播公告</th>
		</tr>
	</thead>
		<tr>
			<td colspan="5">
				 <input type="text" id="broadcast_broad" placeholder="广播公告" class="col-xs-6 col-sm-12">
			</td>

			<td>
				 <button valign="bottom" type="button" onclick="broadcast('broad');" class="btn   btn-primary btn-sm">
							发送
				</button>
			</td>

        </tr>

	<thead>
		<tr>
			<th  style="text-align:left" colspan="6">服务器操作</th>
		</tr>
	</thead>
	<tbody>
		<tr>

		<%if $serverOperation %>
		<%foreach from=$serverOperation item=serverOperation%>
			<td colspan="2" >
				 <button valign="bottom" type="button" onclick="serverOperation(<%$serverOperation.id%>);" class="btn   btn-primary btn-sm">
							<%$serverOperation.desc%>
				</button>
			</td>
		<%/foreach%>
		<%/if%>
		</tr>
		<tr>
		<td colspan="6" style="width:100%;"> <textarea placeholder="执行结果" id="result" class="comments" rows="2" name="s1" cols="50" onpropertychange="this.style.posHeight=this.scrollHeight"></textarea>
		</td>
		</tr>
	</tbody>
</table>

</center>
</div>






<div  id="view7"  style="display:none" class="table-responsive">


<center>
<div  style="width:100%;" class="table-header">
公告相关
</div>
</center>


<center>
	<center>
		<table style="width:100%;" id="gonggao" class="table table-striped table-bordered table-hover">
			<%foreach from = $gonggaos key = key item = value%>
			<tr>
				<td colspan="1">渠道名称</td>
				<td colspan="1">公告内容</td>
				<td colspan="1">操作</td>
			</tr>
			<tr>
				<td colspan="1"><%$key%></td>
				<td colspan="1" style="width:100%;">
					<textarea placeholder="请填写公告" id="ggcontent-<%$key%>" class="comments" rows="5" name="s1" cols="50" onpropertychange="this.style.posHeight=this.scrollHeight"><%$value.notice%></textarea>
				</td>
				<td colspan="1"><button valign="bottom" type="button" data-qd="<%$key%>" class="btn btn-primary btn-sm ggsend">发送</button></td>
			</tr>
			<%/foreach%>
		</table>

	</center>
	<input id="sendggurl" type="hidden" value="<%$sendggurl%>">
</center>
</div>

<div  id="view6"  style="display:none" class="table-responsive">
<center>
	<div  style="width:100%;" class="table-header">
		批量补偿
	</div>
</center>
<center>
	<table  style="width:100%;"  id="sample-table-1"
			class="table table-striped table-bordered table-hover">
		<thead>
		<tr>
			<th style="text-align:left" colspan="6">批量补偿邮件</th>
		</tr>
		</thead>
		<tr>
			<td colspan="5" >
				<input type="text" id="mul_playerId" placeholder="playerId(用,隔开)" value="<%$playerIds%>" class="col-xs-12 col-sm-12">
			</td>

			<td  rowspan="4">

				<button style="margin-top:10px;" valign="bottom" type="button" onclick="selectMulUserInfo();" class="btn   btn-primary btn-sm">
					查询
				</button>
				<br/>
				<button style="margin-top:40px;" valign="bottom" type="button" onclick="sendMulUserAward();" class="btn   btn-primary btn-sm">
					发送
				</button>
			</td>

		</tr>
		<tr>

			<td colspan="5" >
				<!--	 <textarea class="comments" style="border-color:#D5D5D5" placeholder="奖励内容" id="server_awardInfo"  rows="3" name="s1" cols="10" onpropertychange="this.style.posHeight=this.scrollHeight"></textarea> -->
				<input type="text" id="mul_awardMsg" placeholder="补偿说明" class="col-xs-12 col-sm-12">
			</td>

		</tr>


		<tr>
			<td colspan="5" >
				<!--	 <textarea class="comments" style="border-color:#D5D5D5" placeholder="奖励内容" id="server_awardInfo"  rows="3" name="s1" cols="10" onpropertychange="this.style.posHeight=this.scrollHeight"></textarea> -->
				<input type="text" id="mul_awardInfo" placeholder="(奖励内容)可手动输入奖励内容或使用下方菜单添加奖励" class="col-xs-12 col-sm-12">
			</td>
		</tr>


		<tr>
			<td colspan="1">
				<select id="itemType3">
					<option value="">类别</option>
					<%if $gm_awardsinfo%> <%foreach from = $gm_awardsinfo key = key item = data%>
					<%if $nowAttr == $data.id %>
					<option value="<%$data.id%>" selected><%$data.name%></option>
					<%else%>
					<option value="<%$data.id%>"><%$data.name%></option>
					<%/if%> <%/foreach%> <%/if%>
				</select>
			</td>
			<td colspan="1">
				<select style="width:120px;" id="itemTools3">
					<option value="" >物品</option>
				</select>

			</td>
			<td colspan="1">
				<input type="text" id="itemNum3" placeholder="数量" class="col-xs-6 col-sm-6">
			</td>
			<td colspan="1">
				<button  valign="bottom" type="button" onclick="addItems(3);" class="btn btn-primary btn-sm">
					添加
				</button>
			</td>
			<td colspan="1">
				<button  valign="bottom" type="button" onclick="removeItems(3);" class="btn btn-primary btn-sm">
					重置
				</button>
			</td>
		</tr>

		<thead>
		<tr>
			<th>playerId</th>
			<th>puid</th>
			<th>playerName</th>
			<th>level</th>
			<th>isOnline</th>
			<th>status</th>
		</tr>
		</thead>
		<tbody>
		<%foreach from=$playerInfos item=playerInfo%>
		<tr>
			<td  ><%$playerInfo.id%></td>
			<td  ><%$playerInfo.puid%></td>
			<td  ><%$playerInfo.name%></td>
			<td  ><%$playerInfo.level%></td>
			<td  ><%$playerInfo.isOnline%></td>
			<td  ><%$playerInfo.status%></td>
		<tr/>
		<%/foreach%>
		</tbody>

		<tr>
			<td colspan="6" style="width:100%;"> <textarea placeholder="执行结果" id="mul_result" class="comments" rows="5" name="s1" cols="50" onpropertychange="this.style.posHeight=this.scrollHeight"></textarea>
			</td>
		</tr>
		</tbody>
	</table>

</center>
</div>

<div  id="view8"  style="display:none" class="table-responsive">


		<center>
			<div  style="width:100%;" class="table-header">
				区服状态
			</div>
		</center>


		<center>
			<center>
				<table style="width:100%;" id="serverState" class="table table-striped table-bordered table-hover">

					<tr>
						<th><input type="checkbox" name="selectall"/>  </th>
						<th>ID</th>
						<th>区服名</th>
						<th>当前状态</th>
						<th>选中项设置为：
							<button valign="bottom" type="button"  class="btn btn-primary btn-sm batchChangeState" data-state="1" ><font style="color:grey">维护</font></button>
							<button valign="bottom" type="button"  class="btn btn-primary btn-sm batchChangeState" data-state="2"><font style="color:green">新服</font></button>
							<button valign="bottom" type="button"  class="btn btn-primary btn-sm batchChangeState" data-state="3"><font style="color:red">火爆</font></button>
							<button valign="bottom" type="button"  class="btn btn-primary btn-sm batchChangeState" data-state="4"><font style="color: white;">白名单</font></button>
						</th>
					</tr>

					<%foreach from = $servers key = key item = value%>
					<tr class="serverStateData">
						<td><input type="checkbox" name="check-server" value="<%$value.id%>" /></td>
						<td><%$value.id%></td>
						<td><%$value.name%></td>
						<td style="background-color: #D1EEEE"><%$value.stateText%></td>
						<td>信息:<%$value.wsproxy%></td>
					</tr>
					<%/foreach%>
				</table>

			</center>
		</center>
</div>
<div  id="view9"  style="display:none" class="table-responsive">


		<center>
			<div  style="width:100%;" class="table-header">
				邮件记录查询
			</div>
		</center>


		<center>
			<center>
				<table style="width:100%;" id="sendLogsTable" class="table table-striped table-bordered table-hover">
					<tr>
						<th colspan="2" style="line-height: 34px;">起始时间</th>
						<th colspan="2">
							<div class="col-sm-8">
									<input class="date-picker col-xs-12 col-sm-12" id="sendStartTime" value="<%$sendStartDate%>" type="text" data-date-format="yyyy-mm-dd" />
							</div>
						</th>
						<th colspan="2" style="line-height: 34px;">截止时间</th>
						<th colspan="2">
							<div class="col-sm-8">
								<input class="date-picker col-xs-12 col-sm-12" id="sendEndTime" value="<%$sendEndDate%>" type="text" data-date-format="yyyy-mm-dd" />
							</div>
						</th>
						<th colspan="1">
							<div class="col-sm-8">
								<button valign="bottom" type="button"  id="sendLogButton" class="btn btn-primary btn-sm">查询</button>
							</div>
						</th>

					</tr>
					<tr>
						<th>游戏</th>
						<th>区服</th>
						<th>邮件内容</th>
						<th>发送物品</th>
						<th>邮件类型</th>
						<th>发送人昵称</th>
						<th>收件人ID</th>
						<th>发送时间</th>
						<th>发送结果</th>
					</tr>

					<%foreach from = $sendlogs key = key item = value%>
					<tr class="sendLogData">
						<td><%$value.game%></td>
						<td><%$value.servers%></td>
						<td><%$value.award_msg%></td>
						<td><%$value.sendContentStr%></td>
						<td><%$value.send_type%></td>
						<td><%$value.send_name%></td>
						<td><%$value.playerid%></td>
						<td><%$value.send_time%></td>
						<td><%$value.send_result%></td>
					</tr>
					<%/foreach%>
				</table>

			</center>
		</center>
	</div>
</div>
</div>
<div class ="col-lg-2" >
</div>

<!-- /.page-content --></div>
<!-- /.main-content -->
<script type="text/javascript">

	<%if $channel_0%>
	//全选
	$("#<%$channel_0%>_selectAll").click(function(){
		if(this.checked) {
			$("#<%$channel_0%> :checkbox").prop("checked", true);
		} else {
			$("#<%$channel_0%> :checkbox").prop("checked", false);
		}
	});

	// 反选
	$("#<%$channel_0%>_unSelect").click(function () {//全不选
	     $("#<%$channel_0%> :checkbox").each(function(){
	    	 if(!$(this).is(":checked")) {
	    		 $("#<%$channel_0%> :checkbox").prop("checked", true);
	    	 } else {
	    		 $("#<%$channel_0%> :checkbox").prop("checked", false);
	    	 }
	     })
	});
	<%/if%>

	<%if $channel_1%>
	//全选
	$("#<%$channel_1%>_selectAll").click(function(){
		if(this.checked) {
			$("#<%$channel_1%> :checkbox").prop("checked", true);
		} else {
			$("#<%$channel_1%> :checkbox").prop("checked", false);
		}
	});

	// 反选
	$("#<%$channel_1%>_unSelect").click(function () {//全不选
	     $("#<%$channel_1%> :checkbox").prop("checked", false);
	});
	<%/if%>

	<%if $channel_2%>
	//全选
		$("#<%$channel_2%>_selectAll").click(function(){
		if(this.checked) {
			$("#<%$channel_2%> :checkbox").prop("checked", true);
		} else {
			$("#<%$channel_2%> :checkbox").prop("checked", false);
		}
	});

	// 反选
	$("#<%$channel_2%>_unSelect").click(function () {//全不选
	     $("#<%$channel_2%> :checkbox").prop("checked", false);
	});
	<%/if%>


	<%if $channel_3%>
	//全选
		$("#<%$channel_3%>_selectAll").click(function(){
		if(this.checked) {
			$("#<%$channel_3%> :checkbox").prop("checked", true);
		} else {
			$("#<%$channel_3%> :checkbox").prop("checked", false);
		}
	});

	// 反选
	$("#<%$channel_3%>_unSelect").click(function () {//全不选
	     $("#<%$channel_3%> :checkbox").prop("checked", false);
	});
	<%/if%>

	function view1() {
		$('#view1').css("display", "block");
		$('#view2').css("display", "none");
		$('#view3').css("display", "none");
		$('#view4').css("display", "none");
		$('#view5').css("display", "block");
		$('#view6').css("display", "none");
        $('#view7').css("display", "none");
        $('#view8').css("display", "none");
        $('#view9').css("display", "none");
    }

	function view2() {
		$('#view1').css("display", "none");
		$('#view2').css("display", "block");
		$('#view3').css("display", "none");
		$('#view4').css("display", "none");
		$('#view5').css("display", "block");
		$('#view6').css("display", "none");
        $('#view7').css("display", "none");
        $('#view8').css("display", "none");
        $('#view9').css("display", "none");
    }

	function view3() {
		$('#view1').css("display", "none");
		$('#view2').css("display", "none");
		$('#view3').css("display", "block");
		$('#view4').css("display", "block");
		$('#view5').css("display", "none");
		$('#view6').css("display", "none");
        $('#view7').css("display", "none");
        $('#view8').css("display", "none");
        $('#view9').css("display", "none");
    }

 	function view4() {
		$('#view1').css("display", "none");
		$('#view2').css("display", "none");
		$('#view3').css("display", "none");
		$('#view4').css("display", "none");
		$('#view5').css("display", "none");
		$('#view6').css("display", "block");
        $('#view7').css("display", "none");
        $('#view8').css("display", "none");
        $('#view9').css("display", "none");
    }

    function view5() {
        $('#view1').css("display", "none");
        $('#view2').css("display", "none");
        $('#view3').css("display", "none");
        $('#view4').css("display", "none");
        $('#view5').css("display", "none");
        $('#view6').css("display", "none");
        $('#view7').css("display", "block");
        $('#view8').css("display", "none");
        $('#view9').css("display", "none");
    }

    function view6() {
        $('#view1').css("display", "none");
        $('#view2').css("display", "none");
        $('#view3').css("display", "none");
        $('#view4').css("display", "none");
        $('#view5').css("display", "none");
        $('#view6').css("display", "none");
        $('#view7').css("display", "none");
        $('#view8').css("display", "block");
        $('#view9').css("display", "none");
    }

    function view7() {
        $('#view1').css("display", "none");
        $('#view2').css("display", "none");
        $('#view3').css("display", "none");
        $('#view4').css("display", "none");
        $('#view5').css("display", "none");
        $('#view6').css("display", "none");
        $('#view7').css("display", "none");
        $('#view8').css("display", "none");
        $('#view9').css("display", "block");
    }


    //全选
$("#selectAll").click(function(){
	if(($(this).attr("checked"))) {
		 $("#servers :checkbox").prop("checked", true);
	} else {
		$("#servers :checkbox").prop("checked", false);
	}

});
// 反选
$("#unSelect").click(function () {//全不选
     $("#servers :checkbox").prop("checked", false);
});

	jQuery(function($) {
		$('.date-picker').datepicker({
			autoclose : true
		}).next().on(ace.click_event, function() {
			$(this).prev().focus();
		});

		var oTable1 = $('#sample-table-2').dataTable({
			"aoColumns" : [ {
				"bSortable" : false
			}, {
				"bSortable" : false
			}, {
				"bSortable" : false
			}
			]
		});


	});



	function formSubmit() {
		var game = $('#selectGame').val();
		var platform = $('#platform').val();
		var timeout = $('#timeout').val();
		var command = $('#command').val();

		var servers='';
		$("input[name='checkboxs']:checked").each(function(){
			servers += $(this).val()+',';
		});

		if (!game || !timeout || !command || !servers) {
			alert('请将信息填写完整！');
		} else {
			url = "index.php?mod=Shell&do=showServerList&game="+game+"&platform="+platform+"&servers="+servers+"&command="+command+"&timeout="+timeout;
			window.location.href = url;
		}

	}

	function changeRoleInfo(type, id) {
		valueId = "#"+id;
		changeValue = $(valueId).val();
		var game = $('#selectGame').val();
		var selectServer = $('#selectServer').val();


		var param = {};
		param['mod'] = 'Gm';
		param['do']  = 'changePlayerInfo';

		param['game']  	= game;
		param['key']  	= type;
		param['value']  = changeValue;
		param['serverUrl']  = selectServer;

		$.ajax({
			type:'POST',
			url:'index.php',
			data:param,
			dataType:'html',
			success:function(data) {
				var dataObj = eval("(" + data + ")");//转换为json对象
				if (dataObj.code != 1) {
					alert(dataObj.msg);
				} else {
					alert(dataObj.msg);
					// window.location.href = "index.php";
					window.location.href=window.location.href; // 刷新当前页面
				}

			}
		});

	}


	function selectRole(type) {
		var key = "";
		var value = "";
		if(type == "role") {
			key = "role";
			value = $('#user_role').val();
		} else if(type == "puid") {
			key = "puid";
			value = $('#user_puid').val();
		} else if(type == "id") {
			key = "id";
			value = $('#user_id').val();
		}

		var game = $('#selectGame').val();
		var selectServer = $('#selectServer').val();
		if(!game) {
			alert("请选择游戏");
		}else if(!selectServer) {
			alert("请选择服");
		} else {
			url = "index.php?mod=Gm&do=selectUserInfo&action=1&game="+game+"&"+key+"="+value+"&serverUrl="+selectServer+"&type="+type;
			window.location.href = url;
		}
	}

	// 用户操作
	function userOperation(actionId) {

		var game = $('#selectGame').val();
		var selectServer = $('#selectServer').val();
		var param = {};
		param['mod'] = 'Gm';
		param['do']  = 'userOperation';

		param['actionId']  		= actionId;
		param['game']  			= game;
		param['serverUrl']  	= selectServer;

		$.ajax({
			type:'POST',
			url:'index.php',
			data:param,
			dataType:'html',
			success:function(data) {
				var dataObj = eval("(" + data + ")");//转换为json对象
				if (dataObj.code != 1) {
					alert(dataObj.msg);
				} else {
					alert(dataObj.msg);
				}
			}
		});

	}

	function serverOperation(actionId) {
		var game = $('#selectGame').val();
		//var selectServer = $('#selectServer').val();

		var servers='';
		$("input[name='checkboxs']:checked").each(function(){
				servers += $(this).val()+','
		});

		var param = {};
		param['mod'] = 'Gm';
		param['do']  = 'serverOperation';

		param['actionId']  		= actionId;
		param['game']  			= game;
		param['servers']  	= servers;

		if(!game) {
			alert("请选择游戏");
		} else if(!servers) {
			alert("请选择服");
		} else {
			$.ajax({
				type:'POST',
				url:'index.php',
				data:param,
				dataType:'html',
				success:function(data) {
					$('#result').html(data);
					alert("ok");
					/*
					var dataObj = eval("(" + data + ")");//转换为json对象
					if (dataObj.code != 1) {
						alert(dataObj.msg);
					} else {
						alert(dataObj.msg);
					}
					*/
				}
			});
		}
	}
	// 充值
	function recharge(type) {

		var game = $('#selectGame').val();
		var selectServer = $('#selectServer').val();
		var selectChannel1 = $('#selectChannel1').val();
		var selectChannel2 = $('#selectChannel2').val();
		var goodsId = $('#goodsId').val();

		var orderId = $('#orderId').val();
		var rechargeMoney = $('#rechargeMoney').val();

		if(!game) {
			alert("请选择游戏");
		} else if(!selectServer) {
			alert("请选择服");
		} else if((type == 'id') && !goodsId) {
			alert("请输入商品id");
		} else if((type == 'order') && !rechargeMoney)  {
			alert("请输入充值金额");
		} else {
			var param = {};
			param['mod'] = 'Gm';
			param['do']  = 'recharge';

			param['game']  			= game;
			param['serverUrl']  	= selectServer;
			if(type == 'id') {
				param['channel']  		= selectChannel1;
				param['goodsId']  		= goodsId;
			} else if(type == 'order') {
				param['channel']  		= selectChannel2;
				param['orderId']  		= orderId;
				param['rechargeMoney']  		= rechargeMoney;
			}

			$.ajax({
				type:'POST',
				url:'index.php',
				data:param,
				dataType:'html',
				success:function(data) {
					var dataObj = eval("(" + data + ")");//转换为json对象
					if (dataObj.code != 1) {
						alert(dataObj.msg);
					} else {
						alert(dataObj.msg);
					}
				}
			});
		}
	}

	// 添加装备
	function addEquip() {
		var game = $('#selectGame').val();
		var selectServer = $('#selectServer').val();
		var equipId = $('#equipId').val();
		var equipNum = $('#equipNum').val();
		var starlevel1 = $('#starlevel1').val();
		var starlevel2 = $('#starlevel2').val();

		var param = {};
		param['mod'] = 'Gm';
		param['do']  = 'addEquip';

		param['game']  			= game;
		param['serverUrl']  	= selectServer;
		param['equipId']  		= equipId;
		param['equipNum']  		= equipNum;
		param['starlevel1']  	= starlevel1;
		param['starlevel2']  	= starlevel2;

		if(!game) {
			alert("请选择游戏");
		} else if(!selectServer) {
			alert("请选择服");
		} else  if(!equipId) {
			alert("请输入装备Id");
		} else if(!equipNum) {
			alert("请输入装备数量");
		} else if(!starlevel1) {
			alert("请输入starlevel1");
		} else if(!starlevel2) {
			alert("请输入starlevel1");
		} else {
			$.ajax({
				type:'POST',
				url:'index.php',
				data:param,
				dataType:'html',
				success:function(data) {
					var dataObj = eval("(" + data + ")");//转换为json对象
					if (dataObj.code != 1) {
						alert(dataObj.msg);
					} else {
						alert(dataObj.msg);
					}
				}
			});
		}
	}

	// 发送奖励
	function sendAward() {
		var game = $('#selectGame').val();
		var selectServer = $('#selectServer').val();
		var selectChannel3 = $('#selectChannel3').val();
		var awardMsg = $('#awardMsg').val();
		var awardInfo = $('#awardInfo').val();

		var param = {};
		param['mod'] = 'Gm';
		param['do']  = 'sendAward';

		param['game']  			= game;
		param['serverUrl']  	= selectServer;
		param['awardMsg']  		= awardMsg;
		param['awardInfo']  	= awardInfo;
		param['selectChannel']  	= selectChannel3;

		if(!game) {
			alert("请选择游戏");
		} else if(!selectServer) {
			alert("请选择服");
		} else  if(!awardMsg) {
			alert("请输入消息内容");
		} else {
			$.ajax({
				type:'POST',
				url:'index.php',
				data:param,
				dataType:'html',
				success:function(data) {
					var dataObj = eval("(" + data + ")");//转换为json对象
					if (dataObj.code != 1) {
						alert(dataObj.msg);
					} else {
						alert(dataObj.msg);
					}
				}
			});
		}

	}

	// 发送全服奖励
	function sendServerAward() {
		var game = $('#selectGame').val();
		var selectServer = $('#selectServer').val();
		var awardMsg = $('#server_awardMsg').val();
		var awardInfo = $('#server_awardInfo').val();

		var servers='';
		$("input[name='checkboxs']:checked").each(function(){
				servers += $(this).val()+','
		});

		var param = {};
		param['mod'] = 'Gm';
		param['do']  = 'sendServerAward';

		param['game']  			= game;
		param['servers']  		= servers;
		param['awardMsg']  		= awardMsg;
		param['awardInfo']  	= awardInfo;

		if(!game) {
			alert("请选择游戏");
		} else if(!servers) {
			alert("请选择服");
		} else  if(!awardMsg) {
			alert("请输入邮件内容");
		} else {
			$.ajax({
				type:'POST',
				url:'index.php',
				data:param,
				dataType:'html',
				success:function(data) {
					$('#result').html(data);
					alert("ok");
				}
			});
		}
	}


	// 查询单服单用户奖励
	function selectOneUserInfo() {
		var game = $('#selectGame').val();
		var selectServer = $('#selectServer').val();
		var playerIds = $('#test_playerId').val();

		var param = {};
		param['mod'] = 'Gm';
		param['do']  = 'selectMulUserInfo'; 	// 发送单服多玩家奖励

		param['game']  			= game;
		param['playerIds']  	= playerIds; // playerIds 用,隔开
		param['awardInfo']  	= awardInfo;

		if(!game) {
			alert("请选择游戏");
		} else if(!selectServer) {
			alert("请选择服");
		} else  if(!playerIds) {
			alert("请输入要查询的playerId");
		} else {

			url = "index.php?mod=Gm&do=selectMulUserInfo&action=1&game="+game+"&serverUrl="+selectServer+"&playerIds="+playerIds+"&view=3";
			window.location.href = url;
		}
	}


	// 查询单服多用户奖励
	function selectMulUserInfo() {
		var game = $('#selectGame').val();
		var selectServer = $('#selectServer').val();
		var playerIds = $('#mul_playerId').val();

		var param = {};
		param['mod'] = 'Gm';
		param['do']  = 'selectMulUserInfo'; 	// 发送单服多玩家奖励

		param['game']  			= game;
		param['playerIds']  	= playerIds; // playerIds 用,隔开
		param['awardInfo']  	= awardInfo;

		if(!game) {
			alert("请选择游戏");
		} else if(!selectServer) {
			alert("请选择服");
		} else  if(!playerIds) {
			alert("请输入要查询的playerIds");
		} else {

			url = "index.php?mod=Gm&do=selectMulUserInfo&action=1&game="+game+"&serverUrl="+selectServer+"&playerIds="+playerIds+"&view=4";
			window.location.href = url;

			/*
			$.ajax({
				type:'POST',
				url:'index.php',
				data:param,
				dataType:'html',
				success:function(data) {
					$('#result').html(data);
					alert("ok");
				}
			});
			*/
		}
	}


	// 发送单服 多用户奖励(全服操作里面的测试用)
	function sendMulUserAwardTest() {
		var game = $('#selectGame').val();
		var selectServer = $('#selectServer').val();
		var awardMsg = $('#server_awardMsg').val();
		var awardInfo = $('#server_awardInfo').val();
		var playerIds = $('#test_playerId').val();

		var param = {};
		param['mod'] = 'Gm';
		param['do']  = 'sendMulUserAward';

		param['game']  			= game;
		param['serverUrl']  	= selectServer;
		param['awardMsg']  		= awardMsg;
		param['awardInfo']  	= awardInfo;
		param['playerIds']  	= playerIds;

		if(!game) {
			alert("请选择游戏");
		} else if(!selectServer) {
			alert("请选择服");
		} else  if(!awardMsg) {
			alert("请输入邮件内容");
		} else if (!playerIds) {
			alert("请输入用户playerIds");
		}  else {
			$.ajax({
				type:'POST',
				url:'index.php',
				data:param,
				dataType:'html',
				success:function(data) {
					$('#mul_result').html(data);
					alert("ok");
				}
			});
		}
	}

	// 发送单服 多用户奖励
	function sendMulUserAward() {
		var game = $('#selectGame').val();
		var selectServer = $('#selectServer').val();
		var awardMsg = $('#mul_awardMsg').val();
		var awardInfo = $('#mul_awardInfo').val();
		var playerIds = $('#mul_playerId').val();

		var param = {};
		param['mod'] = 'Gm';
		param['do']  = 'sendMulUserAward';

		param['game']  			= game;
		param['serverUrl']  	= selectServer;
		param['awardMsg']  		= awardMsg;
		param['awardInfo']  	= awardInfo;
		param['playerIds']  	= playerIds;

		if(!game) {
			alert("请选择游戏");
		} else if(!selectServer) {
			alert("请选择服");
		} else  if(!awardMsg) {
			alert("请输入邮件内容");
		} else if (!playerIds) {
			alert("请输入用户playerIds");
		}  else {
			$.ajax({
				type:'POST',
				url:'index.php',
				data:param,
				dataType:'html',
				success:function(data) {
					$('#mul_result').html(data);
					alert("ok");
				}
			});
		}
	}


	function broadcast(type) {

		var game = $('#selectGame').val();
		var servers='';
		$("input[name='checkboxs']:checked").each(function(){
				servers += $(this).val()+','
		});

	//	var selectServer = $('#selectServer').val();

		if(type == "chat") {
			var message = $('#broadcast_chat').val();
		} else if(type == "broad") {
			var message = $('#broadcast_broad').val();
		}

		var param = {};
		param['mod'] = 'Gm';
		param['do']  = 'broadcast';

		param['game']  			= game;
		param['servers']  		= servers;
		param['message']  		= message;
		param['type']  			= type;

		if(!game) {
			alert("请选择游戏");
		} else if(!servers) {
			alert("请选择服");
		} else  if(!message) {
			alert("请输入广播内容");
		} else {
			$.ajax({
				type:'POST',
				url:'index.php',
				data:param,
				dataType:'html',
				success:function(data) {
					$('#result').html(data);
					alert("ok");
				/*
					var dataObj = eval("(" + data + ")");//转换为json对象
					if (dataObj.code != 1) {
						alert(dataObj.msg);
					} else {
						alert(dataObj.msg);
					}
				*/
				}
			});
		}
	}


	// 修改公会leader
	function changeLeader() {
		var game = $('#selectGame').val();
		var selectServer = $('#selectServer').val();
		var allianceId_1 = $('#allianceId_1').val();
		var leaderId = $('#leaderId').val();

		if(!game) {
			alert("请选择游戏");
		} else if(!selectServer) {
			alert("请选择服");
		} else if(!allianceId_1) {
			alert("请输入公会id");
		} else if(!leaderId)  {
			alert("请输入leaderId");
		} else {
			var param = {};
			param['mod'] = 'Gm';
			param['do']  = 'changeLeader';

			param['game']  			= game;
			param['serverUrl']  	= selectServer;
			param['allianceId']  	= allianceId_1;
			param['leaderId']  		= leaderId;

			$.ajax({
				type:'POST',
				url:'index.php',
				data:param,
				dataType:'html',
				success:function(data) {
					var dataObj = eval("(" + data + ")");//转换为json对象
					if (dataObj.code != 1) {
						alert(dataObj.msg);
					} else {
						alert(dataObj.msg);
					}
				}
			});
		}
	}

	// 添加奖励到输入框
	function addItems(id) {
		var itemType 	= $('#itemType'+id).val();
		var itemTools 	= $('#itemTools'+id).val();
		var itemNum 	= $('#itemNum'+id).val();

		var awardInfoId = "";
		if(id == 1) {
			awardInfoId = "awardInfo";
		} else if(id == 2) {
			awardInfoId = "server_awardInfo";
		} else if(id == 3) {
			awardInfoId = "mul_awardInfo";
		}

		var awardInfo = $('#'+awardInfoId).val();
		if(!itemType) {
			alert("请选择类别");
			return ;
		}
		if(!itemTools) {
			alert("请选择物品");
			return ;
		}
		if(!itemNum) {
			alert("请输入数量");
			return ;
		}
		if(isNaN(itemNum)){
			alert("输入不合法,请输入数字");
			return ;
		}

		if(itemNum < 0) {
			alert("不能输入负数,请输入正整数");
			return ;
		}

		var itemStr = itemTools+"_"+itemNum;
		if(awardInfo == "") {
			$('#'+awardInfoId).val(itemStr);
		} else {
			var newItemStr = awardInfo+","+itemStr;
			$('#'+awardInfoId).val(newItemStr);
		}
	}

	/**重置奖励 */
	function removeItems(id) {

		var awardInfoId = "";
		if(id == 1) {
			awardInfoId = "awardInfo";
		} else if(id == 2) {
			awardInfoId = "server_awardInfo";
		} else if (id == 3) {
			awardInfoId = "mul_awardInfo";
		}

		var awardInfo 	= $('#'+awardInfoId).val();
		if(awardInfo != "") {
			$('#'+awardInfoId).val("");
		}
	}


	window.onload = function(){
	    var select = document.getElementById('selectGame');
	    select.onchange = function(){
	        // 更改值后执行的代码
	       var gameName = jQuery("#selectGame  option:selected").text();
	       var game = $('#selectGame').val();
			url = "index.php?mod=Gm&do=selectUserInfo&action=1&game="+game;
			window.location.href = url;
	    }


	    if(<%$view%>) {
	    	// 显示第几个view
	 	   var viewId = "view_"+"<%$view%>";
	 	   document.getElementById(viewId).click();
	    }

	    var itemTypeSelect1 = document.getElementById('itemType1');
		  itemTypeSelect1.onchange = function () {
			  var itemType = $('#itemType1').val();

			  var param = {};
			  param['mod'] = 'Gm';
			  param['do']  = 'getItemByType';
			  param['itemType']  	= itemType;

			  $.ajax({
					type:'POST',
					url:'index.php',
					data:param,
					dataType:'html',
					success:function(data) {
						var dataObj = eval("(" + data + ")");//转换为json对象
						if(dataObj.length == 0) {
							$("#itemTools1").empty();
							$("#itemTools1").append('<option value="">物品</option>');
							return ;
						}
						var length = dataObj.length;
						$("#itemTools1").empty();
						$("#itemTools1").append('<option value="">物品</option>');
						for(var i=0; i<length; i++) {
						/* 	alert(dataObj[i]['itemId']);
							alert(dataObj[i]['type']);
							alert(dataObj[i]['name']);	 */
							var itemInfo = dataObj[i]['type']+"_"+dataObj[i]['itemId'];
							var itemName = dataObj[i]['name'];
							$("#itemTools1").append("<option value='"+itemInfo+"' >"+itemName+"</option>"+"<br/>");
						}
					}
				});
		  }

		  var itemToolsSelect1 = document.getElementById('itemTools1');
		  itemToolsSelect1.onchange = function () {
			  // 清空数量里面的值
			  $("#itemNum1").val("");
		  }

		    var itemTypeSelect2 = document.getElementById('itemType2');
			  itemTypeSelect2.onchange = function () {
				  var itemType = $('#itemType2').val();

				  var param = {};
				  param['mod'] = 'Gm';
				  param['do']  = 'getItemByType';
				  param['itemType']  	= itemType;

				  $.ajax({
						type:'POST',
						url:'index.php',
						data:param,
						dataType:'html',
						success:function(data) {
							var dataObj = eval("(" + data + ")");//转换为json对象
							if(dataObj.length == 0) {
								$("#itemTools2").empty();
								$("#itemTools2").append('<option value="">物品</option>');
								return ;
							}
							var length = dataObj.length;
							$("#itemTools2").empty();
							$("#itemTools2").append('<option value="">物品</option>');
							for(var i=0; i<length; i++) {
							/* 	alert(dataObj[i]['itemId']);
								alert(dataObj[i]['type']);
								alert(dataObj[i]['name']);	 */
								var itemInfo = dataObj[i]['type']+"_"+dataObj[i]['itemId'];
								var itemName = dataObj[i]['name'];
								$("#itemTools2").append("<option value='"+itemInfo+"' >"+itemName+"</option>"+"<br/>");
							}
						}
					});
			  }

			  var itemToolsSelect2 = document.getElementById('itemTools2');
			  itemToolsSelect2.onchange = function () {
				  // 清空数量里面的值
				  $("#itemNum2").val("");
			  }


			  var itemTypeSelect3 = document.getElementById('itemType3');
			  itemTypeSelect3.onchange = function () {
				  var itemType = $('#itemType3').val();

				  var param = {};
				  param['mod'] = 'Gm';
				  param['do']  = 'getItemByType';
				  param['itemType']  	= itemType;

				  $.ajax({
						type:'POST',
						url:'index.php',
						data:param,
						dataType:'html',
						success:function(data) {
							var dataObj = eval("(" + data + ")");//转换为json对象
							if(dataObj.length == 0) {
								$("#itemTools3").empty();
								$("#itemTools3").append('<option value="">物品</option>');
								return ;
							}
							var length = dataObj.length;
							$("#itemTools3").empty();
							$("#itemTools3").append('<option value="">物品</option>');
							for(var i=0; i<length; i++) {
							/* 	alert(dataObj[i]['itemId']);
								alert(dataObj[i]['type']);
								alert(dataObj[i]['name']);	 */
								var itemInfo = dataObj[i]['type']+"_"+dataObj[i]['itemId'];
								var itemName = dataObj[i]['name'];
								$("#itemTools3").append("<option value='"+itemInfo+"' >"+itemName+"</option>"+"<br/>");
							}
						}
					});
			  }

			  var itemToolsSelect1 = document.getElementById('itemTools3');
			  itemToolsSelect1.onchange = function () {
				  // 清空数量里面的值
				  $("#itemNum3").val("");
			  }

	}
</script>
<!--
<div id="wrap">
<p>提示：可以输入"1"开头的</p>
<input id="autoCom" type="text" class="txt">
<input id="autoC" type="text" class="txt">
</div>
-->

<script type="text/javascript">

(autoComplete={
pop_len:10,
pop_cn:'autoDis',
hover_cn:'cur',
source:'<%$sourceData%>'.split('|'),
init:function(){
this.setDom();
return this;
},
bind:function(x){
if(x.getAttribute('type') != 'text' || x.nodeName != 'INPUT')
return null;
var self = this;
x.onkeyup = function(e){
e = e || window.event;
var lis = self.pop.getElementsByTagName('li'),lens = self.pop.getElementsByTagName('li').length,n=lens,temp;
if(e.keyCode == 38){ //键盘up键被按下
if(self.pop.style.display != 'none'){
for(var i=0;i<lens;i++){ //遍历结果数据，判断是否被选中
if(lis[i].className)
temp = i;
else
n--;
}
if(n==0){ //如果没有被选中的li元素，则选中最后一个
lis[lens-1].className = self.hover_cn;
this.value = lis[lens-1].innerHTML;
}else{ //如果有被选中的元素，则选择上一个元素并赋值给input
if(lis[temp] == lis[0]){ //如果选中的元素是第一个孩子节点则跳到最后一个选中
lis[lens-1].className = self.hover_cn;
this.value = lis[lens-1].innerHTML;
lis[temp].className = '';
}else{
lis[temp-1].className = self.hover_cn;
this.value = lis[temp-1].innerHTML;
lis[temp].className = '';
}
}
}else //如果弹出层没有显示则执行插入操作，并显示弹出层
self.insert(this);
}else if(e.keyCode == 40){ //down键被按下，原理同up键
if(self.pop.style.display != 'none'){
for(var i=0;i<lens;i++){
if(lis[i].className)
temp = i;
else
n--;
}
if(n==0){
lis[0].className = self.hover_cn;
this.value = lis[0].innerHTML;
}else{
if(lis[temp] == lis[lens-1]){
lis[0].className = self.hover_cn;
this.value = lis[0].innerHTML;
lis[temp].className = '';
}else{
lis[temp+1].className = self.hover_cn;
this.value = lis[temp+1].innerHTML;
lis[temp].className = '';
}
}
}else
self.insert(this);
}else //如果按下的键既不是up又不是down那么直接去匹配数据并插入
self.insert(this);
};
x.onblur = function(){ //这个延迟处理是因为如果失去焦点的时候是点击选中数据的时候会发现先无法触发点击事件
setTimeout(function(){self.pop.style.display='none';},300);
};
return this;
},
setDom:function(){
var self = this;
var dom = document.createElement('div'),frame=document.createElement('iframe'),ul=document.createElement('ul');
document.body.appendChild(dom);
with(frame){ //用来在ie6下遮住select元素
setAttribute('frameborder','0');
setAttribute('scrolling','no');
style.cssText='z-index:-1;position:absolute;left:0;top:0;'
}
with(dom){ //对弹出层li元素绑定onmouseover，onmouseover
className = this.pop_cn;
appendChild(frame);
appendChild(ul);
onmouseover = function(e){ //在li元素还没有加载的时候就绑定这个方法，通过判断target是否是li元素进行处理
e = e || window.event;
var target = e.srcElement || e.target;
if(target.tagName == 'LI'){ //添加样式前先把所有的li样式去掉，这里用的是一种偷懒的方式，没有单独写removeClass方法
for(var i=0,lis=self.pop.getElementsByTagName('li');i<lis.length;i++)
lis[i].className = '';
target.className=self.hover_cn; //也没有写addClass方法，直接赋值了
}
};
onmouseout = function(e){
e = e || window.event;
var target = e.srcElement || e.target;
if(target.tagName == 'LI')
target.className='';
};
}
this.pop = dom;
},
insert:function(self){
var bak = [],s,li=[],left=0,top=0,val=self.value;
for(var i=0,leng=this.source.length;i<leng;i++){ //判断input的数据是否与数据源里的数据一致
if(!!val&&val.length<=this.source[i].length&& this.source[i].substr(0,val.length) == val){
bak.push(this.source[i]);
}
}
if(bak.length == 0){ //如果没有匹配的数据则隐藏弹出层

	/*
	this.pop.style.display='none';
	return false;
	*/
	// 没有匹配的所有都列出来
	for(var i=0,leng=this.source.length;i<leng;i++){ //判断input的数据是否与数据源里的数据一致
		bak.push(this.source[i]);
	}

}//这个弹出层定位方法之前也是用循环offsetParent，但发现ie跟ff下差别很大（可能是使用方式不当），所以改用这个getBoundingClientRect
left=self.getBoundingClientRect().left+document.documentElement.scrollLeft;
top=self.getBoundingClientRect().top+document.documentElement.scrollTop+self.offsetHeight;
with(this.pop){
style.cssText = 'width:'+self.offsetWidth+'px;'+'position:absolute;left:'+left+'px;top:'+top+'px;display:none;';
getElementsByTagName('iframe')[0].setAttribute('width',self.offsetWidth);
getElementsByTagName('iframe')[0].setAttribute('height',self.offsetHeight);
onclick = function(e){
e = e || window.event;
var target = e.srcElement || e.target;
if(target.tagName == 'LI')
self.value = target.innerHTML;
this.style.display='none';
};
}
s = bak.length>this.pop_len?this.pop_len:bak.length;
for(var i=0;i<s;i++)
li.push( '<li>' + bak[i] +'</li>');
this.pop.getElementsByTagName('ul')[0].innerHTML = li.join('');
this.pop.style.display='block';
}
}).init().bind(document.getElementById('awardInfo2')).bind(document.getElementById('autoCom2'));
</script>

<script type="text/javascript">
    $(document).ready(function(){
		$('.ggsend').on('click',function(){
		var  qudao = $(this).attr('data-qd');
		var content = $('#ggcontent-'+qudao).val();
		if(content.length == 0){
			if(!confirm('确定将渠道'+qudao+'的公告清空吗')){
				return false
			}
		}
		$.ajax({
			type: "POST",
			url: "index.php?mod=Gm&do=sendNoticAjax",
			data: {'qudao':qudao,'content':content},
			dataType: 'json',
			success: function(data) {
				alert('公告发送成功')
			},
			error: function(e) {
				alert('系统错误,请稍后再试')
			}
		});
        });
		//区服状态 全选/全不选
        $('input[name="selectall"]').click(function(){
            if($(this).is(':checked')){
                $('input[name="check-server"]').each(function(){
                    $(this).prop("checked",true);
                });
            }else{
                $('input[name="check-server"]').each(function(){
                    $(this).removeAttr("checked",false);
                });
            }

        });
    });

    $('.batchChangeState').on('click',function(){
		var state = $(this).attr('data-state');
        var obj=document.getElementsByName('check-server');
        var serverIds='';
        for(var i=0; i<obj.length; i++){
            if(obj[i].checked) {serverIds+=obj[i].value+',';} //如果选中，将value添加到变量s中
        }
		if(serverIds==''){
        	alert('你还没有选择任何服务器')
			return false
    	}
        $.ajax({
            type: "POST",
            url: "index.php?mod=Gm&do=setServerStateAjax",
            data: {'state':state,'serverIds':serverIds},
            dataType: 'json',
            success: function(data) {
                alert('服务器状态设置成功');
                serverInfo = data.data
				var serverStateData = '';
                for(var i=0;i<serverInfo.length;i++){
                    console.log(i+"--"+serverInfo[i]['name']);
                    serverStateData +='<tr class="serverStateData">';
                    serverStateData +='<td><input type="checkbox" name="check-server" value="'+serverInfo[i]['id']+'" /></td>';
                    serverStateData +='<td>'+serverInfo[i]['id']+'</td>';
                    serverStateData +='<td>'+serverInfo[i]['name']+'</td>';
                    serverStateData +='<td style="background-color: #D1EEEE">'+serverInfo[i]['stateText']+'</td>';
                    serverStateData +='<td>信息:'+serverInfo[i]['wsproxy']+'</td>';
                    serverStateData +='</tr>';
                }
                $('input[name="selectall"]').removeAttr("checked",false);
                $('.serverStateData').remove();
                $('#serverState').append(serverStateData);
            },
            error: function(e) {
                alert('系统错误,请稍后再试')
            }
        });

    });

    $('#sendLogButton').on('click',function(){
		var sendStartTime = $('#sendStartTime').val();
		var sendEndTime = $('#sendEndTime').val();
        $.ajax({
            type: "POST",
            url: "index.php?mod=Gm&do=getSendLogsAjax",
            data: {'sendStartTime':sendStartTime,'sendEndTime':sendEndTime},
            dataType: 'json',
            success: function(data) {
				if(data.code != 0){
					alert(data.msg);
					return false
            	}
                sendLogs = data.data;
                var sendLogData = '';
				if(sendLogs.length <= 0){
                    sendLogData +='<tr class="sendLogData">';
                    sendLogData +='<td colspan="9">无数据</td>';
                    sendLogData +='</tr>';
				}else{
                    for(var i=0;i<sendLogs.length;i++){
                        sendLogData +='<tr class="sendLogData">';

                        sendLogData +='<td>'+sendLogs[i]["game"]+'</td>';
                        sendLogData +='<td>'+sendLogs[i]["servers"]+'</td>';
                        sendLogData +='<td>'+sendLogs[i]["award_msg"]+'</td>';
                        sendLogData +='<td>'+sendLogs[i]["sendContentStr"]+'</td>';
                        sendLogData +='<td>'+sendLogs[i]["send_type"]+'</td>';
                        sendLogData +='<td>'+sendLogs[i]["send_name"]+'</td>';
                        sendLogData +='<td>'+sendLogs[i]["playerid"]+'</td>';
                        sendLogData +='<td>'+sendLogs[i]["send_time"]+'</td>';
                        sendLogData +='<td>'+sendLogs[i]["send_result"]+'</td>';
                        sendLogData +='</tr>';
                    }
				}

                $('.sendLogData').remove();
                $('#sendLogsTable').append(sendLogData);
            },
            error: function(e) {
                alert('系统错误,请稍后再试')
            }
        });

	});

</script>

<%include file="footer.html"%>

